<?php
//start the session
session_start();
//If the session is already active, redirect to device_log.php
if (session_is_registered(myusername))
{
        header("Location: main.php");
}
else
{
	//the session variable is not registered/active, display login form

	?>
<html>
<head>
<link type="text/css" href="css/content.css" rel="Stylesheet" />
<link type="text/css" href="css/ui.css" rel="Stylesheet" />

<script type="text/javascript">

function setFocus(id) {
	document.getElementById(id).focus();
}

</script>

</head>
<body onload="setFocus('loginUsername');" style="text-align: center; background: #4c4c4c">
<div style="height: 200px">
&nbsp;
</div>

<div style="padding: 8px; background: #f3f3f3; border: solid 2px #3f3f3f; text-align: left; width: 300px; margin: 0 auto">
<div style="font-weight: bolder; text-align: center; font-size: 16px; padding-bottom: 10px">Occam Provisioning System</div>
<form name="loginForm" id="loginForm" action="checkLogin.php" method="POST">
        <div class="formLabel">Username:</div>
        <div class="formField"><input class="input" type="text" id="loginUsername" name="username"></input></div>
        <div class="clear"></div>

        <div class="formLabel">Password:</div>
        <div class="formField"><input class="input" type="password" id="loginPassword" name="password"></input></div>
        <div class="clear"></div>

        <div class="formField"><input style="float: right" type="submit" id="loginSubmit" name="Login" value="Login"></input></div>
        <div class="clear"></div>

</form>

</div>
</body>
</html>
	<?php
}

?>
